﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="Microsoft.Web.Mvc"%>
<asp:Content ID="registerHead" ContentPlaceHolderID="head" runat="server">
    <title>Chỉnh sửa thông tin cá nhân</title>
</asp:Content>
<asp:Content ID="js_css" ContentPlaceHolderID="js_css" runat="server">
<style>
label.contact 
{
	width:110px;
}
input.contact_input
{
	width:208px;
}
</style>
</asp:Content>
<asp:Content ID="registerContent" ContentPlaceHolderID="left_content" runat="server">
<div class="crumb_nav">
             <a href="/home/index">Trang Chủ</a> &gt;&gt; chỉnh sửa thông tin cá nhân 
            </div>
            
            <div class="title"><span class="title_icon"><img title="" alt="" src="/content/images/bullet1.gif"></span>Chỉnh sửa thông tin cá nhân</div>
            
<div class="feat_prod_box_details">
            <p class="details">
            
            </p>
            
              	<div class="contact_form">
                <div class="form_subtitle">Sửa thông tin</div>
                 
                 <div style="text-align:center;">
                  <% if (ViewData["success"] != null)
                   { %>
                <div class="success"><%= Html.Encode(ViewData["success"])%></div>
                <%} %>
                <% if (ViewData["error"] != null)
                   { %>
                <div class="warning"><%= Html.Encode(ViewData["error"])%></div>
                <%} %>
                </div>

                 <!-- Start Form -->
                     <form action="/account/edituser" method="post" id="formedit" name="formedit">          
                      <table class="form">
                        <tbody><tr>
                          <td><span class="required">*</span> Tên đăng nhập:</td>
                          <td><%= Html.Encode(ViewData["user_name"])%></td>
                        </tr>
                        <tr>
                          <td>E-Mail:</td>
                          <td><input name="email" id="email" value="<%= Html.Encode(ViewData["email"])%>" size="35" type="text"/></td>
                        </tr>		
                        <tr>
                          <td>Địa chỉ:</td>
                          <td><input name="address" id="address" value="<%= Html.Encode(ViewData["address"])%>" size="35" type="text"/>
                            </td>
                        </tr>
                        <tr>
                          <td>Điện thoại:</td>
                          <td><input name="phone" id="phone" value="<%= Html.Encode(ViewData["phone"])%>" size="35" type="text"/>
                            </td>
                        </tr>
                        <tr>
                          <td>CMND:</td>
                          <td><input name="cmnd" id="cmnd" value="<%= Html.Encode(ViewData["cmnd"])%>" size="35" type="text"/>
                            </td>
                        </tr>		
                       <tr>
	                <td></td>
	                <td><input type="submit"  onclick="return check_validate()" value="Sửa" class="register"/></td>
	                </tr>
                      </tbody></table>
                    </form>
                  <!-- End Form -->   
                </div>  
            
          </div>	

<script type="text/javascript">
    function check_validate() {

        if (document.getElementById("email").value == "") {
            alert('Vui lòng nhập email');
            document.getElementById("email").focus();
            return false;
        }
        else if (checkEmail(document.getElementById("email").value) != true) {
            alert('Email không hợp lệ');
            document.getElementById("email").focus();
            return false;
        }
        else if (document.getElementById("phone").value == "" || isNaN(document.getElementById("phone").value) == true) {
            alert("Số điện thoại chưa nhập hoặc chưa chính xác");
            document.getElementById("phone").focus();
            return false;
        }
        else if (document.getElementById("cmnd").value == "" || isNaN(document.getElementById("cmnd").value) == true) {
            alert("Số cmnd chưa nhập hoặc chưa chính xác");
            document.getElementById("cmnd").focus();
            return false;
        }
        else {
            $('#formedit').submit();
        }

    }
    function checkEmail(value) {
        if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(value))
            return true;
        else
            return false;
    }
</script>   
 </asp:Content>
<asp:Content ID="indexContentRight" ContentPlaceHolderID="right_content" runat="server">
   <% Html.RenderAction("index","sidebar"); %>
</asp:Content>
